//
//  ReadingCell.m
//  Reading
//
//  Created by 军哥 on 15-1-27.
//  Copyright (c) 2015年 军哥. All rights reserved.
//

#import "ReadingCell.h"

@interface ReadingCell()
- (void)setReadingcell;
@end


@implementation ReadingCell
- (void)dealloc
{
    [_contentLabel release];
    [_titleLabel release];
    [_pictureImage release];
    [_BackGview release];
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setReadingcell];
    }
    return self;
}
- (void)setReadingcell
{
    //最大的view
    self.BackGview = [[UIView alloc]init];
    //设置那个圆角的有多圆
    self.BackGview.layer.cornerRadius = 5;
    //反着 适应 圆边角
    self.BackGview.layer.masksToBounds = YES;
    [self.contentView addSubview:self.BackGview];
    [_BackGview release];
    
    //图片imageview
    self.pictureImage = [[UIImageView alloc]init];
    [self.BackGview addSubview:_pictureImage];
    [_pictureImage release];
    
    
    //文章标题label
    self.titleLabel = [[UILabel alloc]init];
    [self.BackGview addSubview:self.titleLabel];
    [_titleLabel release];
    
    //副标题label
    self.contentLabel = [[UILabel alloc]init];
    [self.BackGview addSubview:self.contentLabel];
    [_contentLabel release];
    
    
    //最后统一删掉
    _BackGview.backgroundColor = [UIColor redColor];
    _pictureImage.backgroundColor = [UIColor cyanColor];
    _titleLabel.backgroundColor = [UIColor greenColor];
    _contentLabel.backgroundColor = [UIColor yellowColor];
    
    

}
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    _BackGview.frame = CGRectMake(10, 10, self.contentView.frame.size.width-20, self.contentView.frame.size.height-20);
    
    _pictureImage.frame = CGRectMake(0, 0, self.BackGview.frame.size.width, self.BackGview.frame.size.height*4/7);
    
    _titleLabel.frame = CGRectMake(0, self.BackGview.frame.size.height*4/7, self.BackGview.frame.size.width, self.BackGview.frame.size.height/7);
    
    _contentLabel.frame = CGRectMake(0, self.BackGview.frame.size.height*5/7, self.BackGview.frame.size.width, self.BackGview.frame.size.height*2/7);
    
}







- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
